package com.shenzhen.horselive.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shenzhen.horselive.R;
import com.shenzhen.horselive.beans.MeFragmentItemBean;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class MeAdapter extends BaseQuickAdapter<MeFragmentItemBean, BaseViewHolder> {
    public MeAdapter(int layoutResId, @Nullable List<MeFragmentItemBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, MeFragmentItemBean meFragmentItemBean) {
        if (TextUtils.isEmpty(meFragmentItemBean.getText()))
        {
            baseViewHolder.setVisible(R.id.tv_text,false);
        }
        else
        {
            baseViewHolder.setText(R.id.tv_text,meFragmentItemBean.getText());
            baseViewHolder.setVisible(R.id.tv_text,true);

        }
        baseViewHolder.setImageResource(R.id.img_ico,meFragmentItemBean.getPic());
        baseViewHolder.setText(R.id.tv_name,meFragmentItemBean.getName());
    }
}
